﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
         CodeBehind="RoomBooking.aspx.cs" Inherits="LuxuryResort.WebSite.Members.RoomBooking" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <!-- add styles -->
    <link href="../Styles/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css" />
    <!-- add scripts -->
    <script src="../Scripts/jquery-ui-1.10.4.custom.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        Room Booking
    </h1>
    <fieldset>
        <legend>Search Information</legend>
        <table class="roomInformation" width="100%">
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="Room Type"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlRoomType" runat="server">
                        <asp:ListItem Value="All"> --- All --- </asp:ListItem>
                        <asp:ListItem Value="Standard"> Standard </asp:ListItem>
                        <asp:ListItem Value="Deluxe"> Deluxe </asp:ListItem>
                        <asp:ListItem Value="Royal"> Royal </asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="Check In"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtCheckInTime" runat="server"></asp:TextBox>
                </td>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="Check Out"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtCheckOutTime" runat="server"></asp:TextBox>
                </td>
                <td>
                    <asp:Button ID="btnSearch" runat="server" Text="Search Availibity" Width="110px" CssClass="normalButton"
                                OnClick="btnSearch_Click" />
                </td>
            </tr>
        </table>
    </fieldset>
    <fieldset>
        <legend>Room Booking</legend>
        <asp:ListView ID="lvRooms" runat="server" OnItemCommand="lvRooms_ItemCommand">
            <LayoutTemplate>
                <table class="roomList">
                    <tr>
                        <th style="width: 10%">
                            Room No
                        </th>
                        <th>
                            Room Type
                        </th>
                        <th>
                            Price
                        </th>
                        <th>
                            Book Room
                        </th>
                    </tr>
                    <tr runat="server" id="itemPlaceholder">
                    </tr>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td style="text-align: center; width: 10%;">
                        <asp:Label ID="lblRoomNo" runat="server" Text='<%#Eval("RoomNo") %>' />
                    </td>
                    <td>
                        <asp:Label ID="lblRoomType" runat="server" Text='<%#Eval("RoomType") %>' />
                    </td>
                    <td>
                        <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("PriceUnit") %>' />
                    </td>
                    <td style="text-align: center; width: 10%;">
                        <asp:LinkButton ID="lnkBook" runat="server" Text="Book" CommandName="Book" CausesValidation="False"></asp:LinkButton>
                        <asp:HiddenField ID="hidRoomId" runat="server" Value='<%#Eval("RMID") %>' />
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
        <asp:DataPager ID="pgRooms" runat="server" PagedControlID="lvRooms" PageSize="10"
                       OnPreRender="DataPagerProducts_PreRender">
            <Fields>
                <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" />
                <asp:NumericPagerField />
                <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" />
            </Fields>
        </asp:DataPager>
    </fieldset>
    <span id="lblMessage" class="failureNotification"></span>
    <div runat="server" id="divRoomInformation" visible="false">
        <fieldset>
            <legend>Booking information</legend>
            <table width="100%" class="roomInformation">
                <tr>
                    <td style="width: 20%">
                        Room Number
                    </td>
                    <td style="width: 40%">
                        <b>
                            <asp:Label ID="lblRoomNumber" runat="server"></asp:Label></b>
                    </td>
                    <td>
                        Room Type
                    </td>
                    <td>
                        <b>
                            <asp:Label ID="lblRoomType" runat="server"></asp:Label></b>
                    </td>
                </tr>
                <tr>
                    <td>
                        Customer Name
                    </td>
                    <td>
                        <asp:TextBox ID="txtCustomerName" runat="server" MaxLength="100"></asp:TextBox><br />
                        <asp:RequiredFieldValidator ID="reqName" runat="server" ControlToValidate="txtCustomerName"
                                                    Display="Static" ErrorMessage="You must input Customer Name" CssClass="failureNotification"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        Payment method
                    </td>
                    <td>
                        <asp:DropDownList ID="cboPaymentMethod" runat="server">
                            <asp:ListItem Text="Cash" Value="Cash"></asp:ListItem>
                            <asp:ListItem Text="Card" Value="Card"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        Date From
                    </td>
                    <td>
                        <asp:TextBox ID="txtDateFrom" runat="server" ReadOnly=true></asp:TextBox>
                        <br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDateFrom"
                                                    Display="Static" ErrorMessage="You must input check in date" CssClass="failureNotification"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        Date To
                    </td>
                    <td>
                        <asp:TextBox ID="txtDateTo" runat="server" ReadOnly=true></asp:TextBox><br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtDateTo"
                                                    Display="Static" ErrorMessage="You must input check out date" CssClass="failureNotification"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <asp:Button ID="btnBook" runat="server" OnClick="btnBook_Click" Text="Book Room" CssClass="normalButton" />
                    </td>
                </tr>
            </table>
            <asp:HiddenField ID="hidRoomID" runat="server" />
            <asp:HiddenField ID="hidRoomPrice" runat="server" />
        </fieldset>
    </div>
    <script type="text/javascript">
        $(function() {
            $.datepicker.setDefaults(
                $.extend($.datepicker.regional[''])
            );
            $('[id$="txtCheckInTime"]').datepicker({ dateFormat: 'dd/mm/yy' });
            $('[id$="txtCheckOutTime"]').datepicker({ dateFormat: 'dd/mm/yy' });
//            $('[id$="txtDateFrom"]').datepicker({ dateFormat: 'dd/mm/yy' });
//            $('[id$="txtDateTo"]').datepicker({ dateFormat: 'dd/mm/yy' });
        });
    </script>
</asp:Content>